import type { MaSearchItem } from '@mineadmin/search'
import MaDictSelect from '@/components/ma-dict-picker/ma-dict-select.vue'
import MaDictRadio from '@/components/ma-dict-picker/ma-dict-radio.vue'
import MaRemoteSelect from '@/components/ma-remote-select/index.vue'
import { page as getRodList } from '@/plugins/ai-warning/device/api/rdDeviceRod.ts'
import VoiceSelect from './VoiceSelect.vue'

export default function getSearchItems(t: any): MaSearchItem[] {
    return [
    { 
      label: '录像机名称', 
      prop: 'name', 
      render: 'input', 
      renderProps: { placeholder: t('form.pleaseInput', { msg: '录像机名称'}) } 
    },
    { 
      label: '装置ID', 
      prop: 'rod_id', 
      render: () => MaRemoteSelect, 
      renderProps: { 
        api: getRodList,
        apiParams: {
          page: 1,
          pageSize: 1000,
        },
        dataHandle: (response: any) => {
          if (response.code === 200 && response.data && response.data.list) {
            return response.data.list.map((rod: any) => ({
              label: rod.name,
              value: rod.id,
            }));
          }
          return [];
        },
        placeholder: "请选择装置",
        filterable: true,
        clearable: true,
      } 
    },
    { 
      label: '在线状态', 
      prop: 'online', 
      render: () => MaDictRadio, 
      renderProps: {
        multiple: false,
        data: [
          { label: "在线", value: 1 },
          { label: "离线", value: 2 },
        ],
      } 
    },
    { 
      label: '名称语音id', 
      prop: 'voice_id', 
      render: () => VoiceSelect, 
      renderProps: {
        audioType: 1, // 设备预警语音
        placeholder: "请选择名称语音",
        apiParams: {
          page: 1,
          pageSize: 1000,
        },
      } 
    },
    { 
      label: '遵守语音id', 
      prop: 'comply_id', 
      render: () => VoiceSelect, 
      renderProps: {
        audioType: 3, // 提示语音
        placeholder: "请选择遵守语音",
        apiParams: {
          page: 1,
          pageSize: 1000,
        },
      } 
    },
    { 
      label: '通道号', 
      prop: 'channel_no', 
      render: 'input', 
      renderProps: { placeholder: t('form.pleaseInput', { msg: '通道号'}) } 
    },
    { 
      label: '序列号', 
      prop: 'device_serial', 
      render: 'input', 
      renderProps: { placeholder: t('form.pleaseInput', { msg: '序列号'}) } 
    },
    { 
      label: '摄像头类型', 
      prop: 'type', 
      render: () => MaDictRadio, 
      renderProps: {
        multiple: false,
        data: [
          { label: "枪机", value: 1 },
          { label: "球机", value: 2 },
        ],
      } 
    },
  ]
}
